import { toHomeFollow } from "./to/toHomeFollow";
import { updateRoomInfo } from "./utils/parseRoomInfo";
import { useStorage } from "./utils/useStorage";


export function taskZbWatch() {
    const storage = useStorage()
    let start = storage.get(`start`, false)
    toHomeFollow()
    home();
    events.emit('log', `开始监控`)
    sleep(1000)
    while (start) {
        try {
            start = storage.get(`start`, false)
            updateRoomInfo()
        } catch (e) {
            events.emit('log', `${(e as any).toString()}`)
        } finally {
            toHomeFollow()
            sleep(1000)
        }
    }
    home();
}